<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h2>内容</h2>
  <button>修改</button>

  <script>
    var btn = document.querySelector('button')
    var h2 = document.querySelector('h2')

    function time() {
      return new Date().getMinutes()
    }

    btn.onclick = function() {
      h2.innerText = time()   // 修改内容
    }
  </script>
</body>
</html>